<?php

/**
 * Users filter form base class.
 *
 * @package    iEasy
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseUsersFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'name'             => new sfWidgetFormFilterInput(),
      'nickname'         => new sfWidgetFormFilterInput(),
      'sex'              => new sfWidgetFormFilterInput(),
      'birthday'         => new sfWidgetFormFilterInput(),
      'telephone'        => new sfWidgetFormFilterInput(),
      'cellphone'        => new sfWidgetFormFilterInput(),
      'email'            => new sfWidgetFormFilterInput(),
      'address'          => new sfWidgetFormFilterInput(),
      'create_time'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'modify_time'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'password'         => new sfWidgetFormFilterInput(),
      'real_name'        => new sfWidgetFormFilterInput(),
      'last_vote_time'   => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'last_survey_time' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'last_login_time'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'avatar'           => new sfWidgetFormFilterInput(),
      'is_activate_b'    => new sfWidgetFormFilterInput(),
      'login_ip'         => new sfWidgetFormFilterInput(),
      'join_ip'          => new sfWidgetFormFilterInput(),
      'member_level_i'   => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'name'             => new sfValidatorPass(array('required' => false)),
      'nickname'         => new sfValidatorPass(array('required' => false)),
      'sex'              => new sfValidatorPass(array('required' => false)),
      'birthday'         => new sfValidatorPass(array('required' => false)),
      'telephone'        => new sfValidatorPass(array('required' => false)),
      'cellphone'        => new sfValidatorPass(array('required' => false)),
      'email'            => new sfValidatorPass(array('required' => false)),
      'address'          => new sfValidatorPass(array('required' => false)),
      'create_time'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'modify_time'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'password'         => new sfValidatorPass(array('required' => false)),
      'real_name'        => new sfValidatorPass(array('required' => false)),
      'last_vote_time'   => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'last_survey_time' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'last_login_time'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'avatar'           => new sfValidatorPass(array('required' => false)),
      'is_activate_b'    => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'login_ip'         => new sfValidatorPass(array('required' => false)),
      'join_ip'          => new sfValidatorPass(array('required' => false)),
      'member_level_i'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('users_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Users';
  }

  public function getFields()
  {
    return array(
      'user_id'          => 'Number',
      'name'             => 'Text',
      'nickname'         => 'Text',
      'sex'              => 'Text',
      'birthday'         => 'Text',
      'telephone'        => 'Text',
      'cellphone'        => 'Text',
      'email'            => 'Text',
      'address'          => 'Text',
      'create_time'      => 'Date',
      'modify_time'      => 'Date',
      'password'         => 'Text',
      'real_name'        => 'Text',
      'last_vote_time'   => 'Date',
      'last_survey_time' => 'Date',
      'last_login_time'  => 'Date',
      'avatar'           => 'Text',
      'is_activate_b'    => 'Number',
      'login_ip'         => 'Text',
      'join_ip'          => 'Text',
      'member_level_i'   => 'Number',
    );
  }
}
